<template>
  <div id="equipmentManage">
    <div class="equipmentTotal">
      <div class="equipmentText">设备总数:</div>
      <div class="number">
        <te-flop
          :number="equipmentTotal"
          :animationTime="3"
          :intervalTime="20000"
        ></te-flop>
      </div>
    </div>
    <div class="title"></div>
    <div class="content">
      <el-row style="margin-bottom: 60px">
        <el-col :span="8">
          <div class="imageItem" @click="flyTokt('total')">
            <div style="float: left; margin-left: 130px">
              <div class="item">空调</div>
              <div class="item" style="color: #6acbff; font-size: 30px">
                {{ ktData.total || 40 }}
              </div>
            </div>
          </div>
          <div class="imageRight">
            <div @click.stop="flyTokt('common')" class="hoverPointer">
              正常：<span class="yh_green">{{ ktData.normal || 38 }}</span>
            </div>
            <div @click.stop="flyTokt('fault')" class="hoverPointer">
              故障：<span class="yh_orange">{{ ktData.fault || 1 }}</span>
            </div>
            <div @click.stop="flyTokt('alarm')" class="hoverPointer">
              报警：<span class="yh_red">{{ ktData.alarm || 1 }}</span>
            </div>
          </div>
        </el-col>
        <el-col :span="8" class="test">
          <div class="imageItem" @click="flyTodt('total')">
            <div style="float: left; margin-left: 130px">
              <div class="item">电梯</div>
              <div class="item" style="color: #6acbff; font-size: 30px">
                {{ dtData.total || 10 }}
              </div>
            </div>
          </div>
          <div class="imageRight">
            <div @click.stop="flyTodt('common')" class="hoverPointer">
              正常：<span class="yh_green">{{ dtData.normal || 10 }}</span>
            </div>
            <div @click.stop="flyTodt('fault')" class="hoverPointer">
              故障：<span class="yh_orange">{{ dtData.fault || 0 }}</span>
            </div>
            <div @click.stop="flyTodt('alarm')" class="hoverPointer">
              报警：<span class="yh_red">{{ dtData.alarm || 0 }}</span>
            </div>
          </div>
        </el-col>
        <el-col :span="8" class="test">
          <div class="imageItem" @click="flyTobpd('total')">
            <div style="float: left; margin-left: 130px">
              <div class="item">变配电</div>
              <div class="item" style="color: #6acbff; font-size: 30px">
                {{ bpdData.total || 8 }}
              </div>
            </div>
          </div>
          <div class="imageRight">
            <div @click.stop="flyTobpd('common')" class="hoverPointer">
              正常：<span class="yh_green">{{ bpdData.normal || 7 }}</span>
            </div>
            <div @click.stop="flyTobpd('fault')" class="hoverPointer">
              故障：<span class="yh_orange">{{ bpdData.fault || 1 }}</span>
            </div>
            <div @click.stop="flyTobpd('alarm')" class="hoverPointer">
              报警：<span class="yh_red">{{ bpdData.alarm || 0 }}</span>
            </div>
          </div>
        </el-col>
      </el-row>
      <el-row style="margin-bottom: 60px">
        <el-col :span="8">
          <div class="imageItem" @click="dzxg('total')">
            <div style="float: left; margin-left: 130px">
              <div class="item">电子巡更</div>
              <div class="item" style="color: #6acbff; font-size: 30px">
                {{ dzxgData.total || 12 }}
              </div>
            </div>
          </div>
          <div class="imageRight">
            <div @click.stop="dzxg('common')" class="hoverPointer">
              正常：<span class="yh_green">{{ dzxgData.normal || 10 }}</span>
            </div>
            <div @click.stop="dzxg('fault')" class="hoverPointer">
              故障：<span class="yh_orange">{{ dzxgData.fault || 1 }}</span>
            </div>
            <div @click.stop="dzxg('alarm')" class="hoverPointer">
              报警：<span class="yh_red">{{ dzxgData.alarm || 1 }}</span>
            </div>
          </div>
        </el-col>
        <el-col :span="8" class="test">
          <div class="imageItem" @click="flyTojjqz('total')">
            <div style="float: left; margin-left: 130px">
              <div class="item">紧急求助</div>
              <div class="item" style="color: #6acbff; font-size: 30px">
                {{ jjqzData.total || 4 }}
              </div>
            </div>
          </div>
          <div class="imageRight">
            <div @click.stop="flyTojjqz('common')" class="hoverPointer">
              正常：<span class="yh_green">{{ jjqzData.normal || 4 }}</span>
            </div>
            <div @click.stop="flyTojjqz('fault')" class="hoverPointer">
              故障：<span class="yh_orange">{{ jjqzData.fault || 0 }}</span>
            </div>
            <div @click.stop="flyTojjqz('alarm')" class="hoverPointer">
              报警：<span class="yh_red">{{ jjqzData.alarm || 0 }}</span>
            </div>
          </div>
        </el-col>
        <el-col :span="8" class="test">
          <div class="imageItem" @click="flyTogb('total')">
            <div style="float: left; margin-left: 130px">
              <div class="item">公共广播</div>
              <div class="item" style="color: #6acbff; font-size: 30px">
                {{ gggbData.total || 5 }}
              </div>
            </div>
          </div>
          <div class="imageRight">
            <div @click.stop="flyTogb('common')" class="hoverPointer">
              正常：<span class="yh_green">{{ gggbData.normal || 5 }}</span>
            </div>
            <div @click.stop="flyTogb('fault')" class="hoverPointer">
              故障：<span class="yh_orange">{{ gggbData.fault || 0 }}</span>
            </div>
            <div @click.stop="flyTogb('alarm')" class="hoverPointer">
              报警：<span class="yh_red">{{ gggbData.alarm || 0 }}</span>
            </div>
          </div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :offset="4" :span="8">
          <div class="imageItem" @click="flyToxxfb('total')">
            <div style="float: left; margin-left: 130px">
              <div class="item">信息发布</div>
              <div class="item" style="color: #6acbff; font-size: 30px">
                {{ xxfbData.total || 26 }}
              </div>
            </div>
          </div>
          <div class="imageRight">
            <div @click.stop="flyToxxfb('common')" class="hoverPointer">
              正常：<span class="yh_green">{{ xxfbData.normal || 20 }}</span>
            </div>
            <div @click.stop="flyToxxfb('fault')" class="hoverPointer">
              故障：<span class="yh_orange">{{ xxfbData.fault || 3 }}</span>
            </div>
            <div @click.stop="flyToxxfb('alarm')" class="hoverPointer">
              报警：<span class="yh_red">{{ xxfbData.alarm || 3 }}</span>
            </div>
          </div>
        </el-col>
        <el-col :span="8" class="test">
          <div class="imageItem" @click="flyTozm('total')">
            <div style="float: left; margin-left: 130px">
              <div class="item">亮化</div>
              <div class="item" style="color: #6acbff; font-size: 30px">
                {{ zmData.total || 10 }}
              </div>
            </div>
          </div>
          <div class="imageRight">
            <div @click.stop="flyTozm('common')" class="hoverPointer">
              正常：<span class="yh_green">{{ zmData.normal || 10 }}</span>
            </div>
            <div @click.stop="flyTozm('fault')" class="hoverPointer">
              故障：<span class="yh_orange">{{ zmData.fault || 0 }}</span>
            </div>
            <div @click.stop="flyTozm('alarm')" class="hoverPointer">
              报警：<span class="yh_red">{{ zmData.alarm || 0 }}</span>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
import { TUVector3, TUVector2 } from "tumap/dist/tumap.v1.8.js";
import "../../../../assets/font/font.css";
import axios from "axios";

export default {
  data() {
    return {
      equipmentTotal: 115,
      pathObj: null,
      isCreateLine: false,

      // 存储所有的项
      allDataItems: [],

      // 请求到的各类型的后台的数据
      ktData: { total: 0, normal: 0, alarm: 0, fault: 0, data: [] },
      dtData: { total: 0, normal: 0, alarm: 0, fault: 0, data: [] },
      bpdData: { total: 0, normal: 0, alarm: 0, fault: 0, data: [] },
      dzxgData: { total: 0, normal: 0, alarm: 0, fault: 0, data: [] },
      jjqzData: { total: 0, normal: 0, alarm: 0, fault: 0, data: [] },
      gggbData: { total: 0, normal: 0, alarm: 0, fault: 0, data: [] },
      xxfbData: { total: 0, normal: 0, alarm: 0, fault: 0, data: [] },
      zmData: { total: 0, normal: 0, alarm: 0, fault: 0, data: [] },
    };
  },
  mounted() {
    this.parseTree();
    window.getTreeDevice = this.parseTree;
  },
  methods: {
    parseTree() {
      var tem = JSON.parse(window.sessionStorage.getItem("treeData"));
      tem&&this.treeForeach(tem, (node) => {
        node.code && this.allDataItems.push(JSON.parse(JSON.stringify(node)));
      });
    },
    clearAll() {
      window.Sgworld.clearAllCovering();
      var timetype = window.sessionStorage.getItem('timeType');
      var weathertype = window.sessionStorage.getItem('weatherType');
      window.Sgworld.execute("grapi", "settime", { type: timetype }, null);
      window.Sgworld.execute("grapi", "setweather", { type: weathertype }, null);
    },
    // 飞向空调
    flyTokt(type) {
      try {
        // 初始化视角
        window.viewInit();
        // 清除所有的poi点位
        this.clearAll();
      } catch (error) {
        console.log(error);
      }
      // 获取所有的数据项
      var temArr = JSON.parse(JSON.stringify(this.allDataItems));
      var Common = [],
        Fault = [],
        Alarm = [];
      if (this.ktData.data) {
        Common = this.ktData.data.filter((item) => {
          return item.state == "0";
        });
        Fault = this.ktData.data.filter((item) => {
          return (item.state == "1"||item.state =="2");
        });
        Alarm = this.ktData.data.filter((item) => {
          return item.state == "3";
        });
      }
      if (Common.length == 0 && Fault.length == 0 && Alarm.length == 0) {
        this.$message("暂无数据");
        return;
      }
      if (type == "total") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "空调系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/ktCommon.png";
                try {
                  window.Sgworld.createBillboard(temObj);
                } catch (error) {
                  console.log(error);
                }

                // break;
              }
            }
          }
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "空调系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/ktFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "空调系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/ktFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "common") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "空调系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/ktFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "fault") {
        for (var i = 0; i < temArr.length; i++) {
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "空调系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/ktFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else {
        for (var i = 0; i < temArr.length; i++) {
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "空调系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/ktAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      }
    },
    // 飞向电梯
    flyTodt(type) {
      // 初始化视角
      window.viewInit();
      // 清除所有的poi点位
      this.clearAll();
      // 获取所有的数据项
      var temArr = JSON.parse(JSON.stringify(this.allDataItems));
      var Common = [],
        Fault = [],
        Alarm = [];
      if (this.dtData.data) {
        Common = this.dtData.data.filter((item) => {
          return item.state == "0";
        });
        Fault = this.dtData.data.filter((item) => {
          return (item.state == "1"||item.state =="2");
        });
        Alarm = this.dtData.data.filter((item) => {
          return item.state == "3";
        });
      }
      if (Common.length == 0 && Fault.length == 0 && Alarm.length == 0) {
        this.$message("暂无数据");
        return;
      }
      if (type == "total") {
        for (var i = 0; i < temArr.length; i++) {
          temArr[i].name =
            "视频-" +
            temArr[i].floorId +
            "_" +
            temArr[i].id +
            "-" +
            temArr[i].label;
          temArr[i].id = temArr[i].floorId + "_" + temArr[i].id;
          temArr[i].x = temArr[i].position.x;
          temArr[i].y = temArr[i].position.y;
          temArr[i].z = temArr[i].position.z;
          temArr[i].scale = 0.3;
          temArr[i].image = "";
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                temArr[i].image =
                  window.ipUrl + "qy/static/images/popups/dtCommon.png";
                window.Sgworld.createBillboard(temArr[i]);
                break;
              }
            }
          }
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                temArr[i].image =
                  window.ipUrl + "qy/static/images/popups/dtFault.png";
                window.Sgworld.createBillboard(temArr[i]);
                break;
              }
            }
          }
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                temArr[i].image =
                  window.ipUrl + "qy/static/images/popups/dtAlarm.png";
                window.Sgworld.createBillboard(temArr[i]);
                break;
              }
            }
          }
        }
      } else if (type == "common") {
        for (var i = 0; i < temArr.length; i++) {
          temArr[i].name =
            "视频-" +
            temArr[i].floorId +
            "_" +
            temArr[i].id +
            "-" +
            temArr[i].label;
          temArr[i].id = temArr[i].floorId + "_" + temArr[i].id;
          temArr[i].x = temArr[i].position.x;
          temArr[i].y = temArr[i].position.y;
          temArr[i].z = temArr[i].position.z;
          temArr[i].scale = 0.3;
          // temArr[i].alertWindow = {
          //   //可选，点击弹窗
          //   url: `${ipUrl}qy/static/html/common.html?title=电梯管理&mc1=所在楼层：&mc2=设备名称：&mc3=所在位置：&position=展示中心大楼&name=${temArr[i].label}&floor=${temArr[i].floorId}&x=${temArr[i].position.x}&y=${temArr[i].position.y}&z=${temArr[i].position.z}&map=${window.Sgworld}`, //弹窗地址,并传递一些信息
          //   size: new TUVector2(1000, 1000), //弹窗大小
          //   offset: new TUVector2(0, -150), //弹窗位置，右：x正，下：y正
          // };
          temArr[i].image = "";
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                temArr[i].image =
                  window.ipUrl + "qy/static/images/popups/dtCommon.png";
                window.Sgworld.createBillboard(temArr[i]);
                break;
              }
            }
          }
        }
      } else if (type == "fault") {
        for (var i = 0; i < temArr.length; i++) {
          temArr[i].name =
            "视频-" +
            temArr[i].floorId +
            "_" +
            temArr[i].id +
            "-" +
            temArr[i].label;
          temArr[i].id = temArr[i].floorId + "_" + temArr[i].id;
          temArr[i].x = temArr[i].position.x;
          temArr[i].y = temArr[i].position.y;
          temArr[i].z = temArr[i].position.z;
          temArr[i].scale = 0.3;
          // temArr[i].alertWindow = {
          //   //可选，点击弹窗
          //   url: `${ipUrl}qy/static/html/common.html?title=电梯管理&mc1=所在楼层：&mc2=设备名称：&mc3=所在位置：&position=展示中心大楼&name=${temArr[i].label}&floor=${temArr[i].floorId}&x=${temArr[i].position.x}&y=${temArr[i].position.y}&z=${temArr[i].position.z}&map=${window.Sgworld}`, //弹窗地址,并传递一些信息
          //   size: new TUVector2(1000, 1000), //弹窗大小
          //   offset: new TUVector2(0, -150), //弹窗位置，右：x正，下：y正
          // };
          temArr[i].image = "";
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                temArr[i].image =
                  window.ipUrl + "qy/static/images/popups/dtFault.png";
                window.Sgworld.createBillboard(temArr[i]);
                break;
              }
            }
          }
        }
      } else {
        for (var i = 0; i < temArr.length; i++) {
          temArr[i].name =
            "视频-" +
            temArr[i].floorId +
            "_" +
            temArr[i].id +
            "-" +
            temArr[i].label;
          temArr[i].id = temArr[i].floorId + "_" + temArr[i].id;
          temArr[i].x = temArr[i].position.x;
          temArr[i].y = temArr[i].position.y;
          temArr[i].z = temArr[i].position.z;
          temArr[i].scale = 0.3;
          // temArr[i].alertWindow = {
          //   //可选，点击弹窗
          //   url: `${ipUrl}qy/static/html/common.html?title=电梯管理&mc1=所在楼层：&mc2=设备名称：&mc3=所在位置：&position=展示中心大楼&name=${temArr[i].label}&floor=${temArr[i].floorId}&x=${temArr[i].position.x}&y=${temArr[i].position.y}&z=${temArr[i].position.z}&map=${window.Sgworld}`, //弹窗地址,并传递一些信息
          //   size: new TUVector2(1000, 1000), //弹窗大小
          //   offset: new TUVector2(0, -150), //弹窗位置，右：x正，下：y正
          // };
          temArr[i].image = "";
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                temArr[i].image =
                  window.ipUrl + "qy/static/images/popups/dtAlarm.png";
                window.Sgworld.createBillboard(temArr[i]);
                break;
              }
            }
          }
        }
      }
    },
    // 飞向变配电
    flyTobpd(type) {
      // 初始化视角
      window.viewInit();
      // 清除所有的poi点位
      this.clearAll();
      // 获取所有的数据项
      var temArr = JSON.parse(JSON.stringify(this.allDataItems));
      var Common = [],
        Fault = [],
        Alarm = [];
      if (this.bpdData.data) {
        Common = this.bpdData.data.filter((item) => {
          return item.state == "0";
        });
        Fault = this.bpdData.data.filter((item) => {
          return (item.state == "1"||item.state =="2");
        });
        Alarm = this.bpdData.data.filter((item) => {
          return item.state == "3";
        });
      }
      if (Common.length == 0 && Fault.length == 0 && Alarm.length == 0) {
        this.$message("暂无数据");
        return;
      }
      if (type == "total") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "变配电系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/bpdCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "变配电系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/bpdFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "变配电系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/bpdAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "common") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "变配电系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/bpdCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "fault") {
        for (var i = 0; i < temArr.length; i++) {
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "变配电系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/bpdFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else {
        for (var i = 0; i < temArr.length; i++) {
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "变配电系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/bpdAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      }
    },
    // 飞向广播
    flyTogb(type) {
      // 初始化视角
      window.viewInit();
      // 清除所有的poi点位
      this.clearAll();
      // 获取所有的数据项
      var temArr = JSON.parse(JSON.stringify(this.allDataItems));
      var Common = [],
        Fault = [],
        Alarm = [];
      if (this.gggbData.data) {
        Common = this.gggbData.data.filter((item) => {
          return item.state == "0";
        });
        Fault = this.gggbData.data.filter((item) => {
          return (item.state == "1"||item.state =="2");
        });
        Alarm = this.gggbData.data.filter((item) => {
          return item.state == "3";
        });
      }
      if (Common.length == 0 && Fault.length == 0 && Alarm.length == 0) {
        this.$message("暂无数据");
        return;
      }
      if (type == "total") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "公共广播-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/gbCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "公共广播-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/gbFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "公共广播-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/gbAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "common") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "公共广播-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/gbCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "fault") {
        for (var i = 0; i < temArr.length; i++) {
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "公共广播-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/gbFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else {
        for (var i = 0; i < temArr.length; i++) {
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "公共广播-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/gbAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      }
    },
    // 飞向信息发布
    flyToxxfb(type) {
      // 初始化视角
      window.viewInit();
      // 清除所有的poi点位
      this.clearAll();
      // 获取所有的数据项
      var temArr = JSON.parse(JSON.stringify(this.allDataItems));
      var Common = [],
        Fault = [],
        Alarm = [];
      if (this.xxfbData.data) {
        Common = this.xxfbData.data.filter((item) => {
          return item.state == "0";
        });
        Fault = this.xxfbData.data.filter((item) => {
          return (item.state == "1"||item.state =="2");
        });
        Alarm = this.xxfbData.data.filter((item) => {
          return item.state == "3";
        });
      }
      if (Common.length == 0 && Fault.length == 0 && Alarm.length == 0) {
        this.$message("暂无数据");
        return;
      }
      if (type == "total") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "信息发布-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/xxfbCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "信息发布-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/xxfbFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "信息发布-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/xxfbAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "common") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "信息发布-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/xxfbCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "fault") {
        for (var i = 0; i < temArr.length; i++) {
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "信息发布-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/xxfbFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else {
        for (var i = 0; i < temArr.length; i++) {
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "信息发布-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/xxfbAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      }
    },
    // 飞向照明
    flyTozm(type) {
      // 初始化视角
      window.viewInit();
      // 清除所有的poi点位
      this.clearAll();
      // 获取所有的数据项
      var temArr = JSON.parse(JSON.stringify(this.allDataItems));
      var Common = [],
        Fault = [],
        Alarm = [];
      if (this.zmData.data) {
        Common = this.zmData.data.filter((item) => {
          return item.state == "0";
        });
        Fault = this.zmData.data.filter((item) => {
          return (item.state == "1"||item.state =="2");
        });
        Alarm = this.zmData.data.filter((item) => {
          return item.state == "3";
        });
      }
      if (Common.length == 0 && Fault.length == 0 && Alarm.length == 0) {
        this.$message("暂无数据");
        return;
      }
      if (type == "total") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "亮化系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/zmCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "亮化系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/zmFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "亮化系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/zmAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "common") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "亮化系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/zmCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "fault") {
        for (var i = 0; i < temArr.length; i++) {
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "亮化系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/zmFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else {
        for (var i = 0; i < temArr.length; i++) {
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "亮化系统-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/zmAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      }
    },
    // 飞向紧急求助
    flyTojjqz(type) {
      // 初始化视角
      window.viewInit();
      // 清除所有的poi点位
      this.clearAll();
      // 获取所有的数据项
      var temArr = JSON.parse(JSON.stringify(this.allDataItems));
      var Common = [],
        Fault = [],
        Alarm = [];
      if (this.jjqzData.data) {
        Common = this.jjqzData.data.filter((item) => {
          return item.state == "0";
        });
        Fault = this.jjqzData.data.filter((item) => {
          return (item.state == "1"||item.state =="2");
        });
        Alarm = this.jjqzData.data.filter((item) => {
          return item.state == "3";
        });
      }
      if (Common.length == 0 && Fault.length == 0 && Alarm.length == 0) {
        this.$message("暂无数据");
        return;
      }
      if (type == "total") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "紧急求助-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/jjqzCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "紧急求助-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/jjqzFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "紧急求助-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/jjqzAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "common") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "紧急求助-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/jjqzCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "fault") {
        for (var i = 0; i < temArr.length; i++) {
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "紧急求助-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/jjqzFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else {
        for (var i = 0; i < temArr.length; i++) {
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "紧急求助-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/jjqzAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      }
    },
    // 飞向电子巡更
    dzxg(type) {
      // 初始化视角
      window.viewInit();
      // 清除所有的poi点位
      this.clearAll();
      // 获取所有的数据项
      var temArr = JSON.parse(JSON.stringify(this.allDataItems));
      var Common = [],
        Fault = [],
        Alarm = [];
      if (this.dzxgData.data) {
        Common = this.dzxgData.data.filter((item) => {
          return item.state == "0";
        });
        Fault = this.dzxgData.data.filter((item) => {
          return (item.state == "1"||item.state =="2");
        });
        Alarm = this.dzxgData.data.filter((item) => {
          return item.state == "3";
        });
      }
      if (Common.length == 0 && Fault.length == 0 && Alarm.length == 0) {
        this.$message("暂无数据");
        return;
      }
      if (type == "total") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "电子巡更-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/dzxgCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "电子巡更-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/dzxgFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "电子巡更-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/dzxgAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "common") {
        for (var i = 0; i < temArr.length; i++) {
          if (Common.length > 0) {
            for (var j = 0; j < Common.length; j++) {
              if (temArr[i].code == Common[j].code) {
                var temObj = {};
                temObj.name = "电子巡更-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/dzxgCommon.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else if (type == "fault") {
        for (var i = 0; i < temArr.length; i++) {
          if (Fault.length > 0) {
            for (var j = 0; j < Fault.length; j++) {
              if (temArr[i].code == Fault[j].code) {
                var temObj = {};
                temObj.name = "电子巡更-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/dzxgFault.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      } else {
        for (var i = 0; i < temArr.length; i++) {
          if (Alarm.length > 0) {
            for (var j = 0; j < Alarm.length; j++) {
              if (temArr[i].code == Alarm[j].code) {
                var temObj = {};
                temObj.name = "电子巡更-" + temArr[i].floorId +"-" +temArr[i].code;
                temObj.id = temArr[i].floorId + "_" + temArr[i].id;
                temObj.x = temArr[i].position.x;
                temObj.y = temArr[i].position.y;
                temObj.z = temArr[i].position.z;
                temObj.scale = 0.3;
                temObj.image = 
                  window.ipUrl + "qy/static/images/popups/dzxgAlarm.png";
                window.Sgworld.createBillboard(temObj);
                break;
              }
            }
          }
        }
      }
    },
    treeForeach(tree, func) {
      let node, list = [...tree];
      while ((node = list.shift())) {
        func(node);
        node.children && list.push(...node.children);
      }
    },
  },
  sockets: {
    sendDeviceStatus(data) {
      let deviceInfo = JSON.parse(data);
      this.equipmentTotal = 0;
      deviceInfo.forEach((item) => {
        this.equipmentTotal += parseInt(item.total);
        switch (item.systemType) {
          case "airConditioner":
            this.ktData = item;
            break;
          case "elevator":
            this.dtData = item;
            break;
          case "powerDistribution":
            this.bpdData = item;
            break;
          case "electronicPatrol":
            this.dzxgData = item;
            break;
          // case "urgentHelp":
          //   this.jjqzData = item;
          //   break;
          case "publicBroadcasting":
            this.gggbData = item;
            break;
          case "informationDelivery":
            this.xxfbData = item;
            break;
          case "lighting":
            this.zmData = item;
            break;
          default:
            break;
        }
      });
    },
    sendAqUrgentHelpStatus(data) {
      this.jjqzData = JSON.parse(data);
    },
  },
};
</script>
<style scoped>
#equipmentManage {
  box-sizing: border-box;
  margin-top: 20px;
}
.title {
  width: 645px;
  height: 112px;
  background: url("../../../../../static/images/equipment.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  margin-bottom: 20px;
  margin-left: -80px;
}
.equipmentTotal {
  float: right;
  height: 51px;
  line-height: 51px;
  margin-top: 20px;
}
.equipmentText {
  float: left;
  font-size: 28px;
  margin-top: 15px;
}
.number {
  display: inline-block;
  /* width: 131px;
  height: 51px; */
}
.numberValue {
  font-size: 52px;
  letter-spacing: 18px;
  margin-left: 10px;
  font-family: "dig";
}
.imageItem {
  width: 223px;
  height: 67px;
  display: inline-block;
  background: url("../../../../../static/images/equipmentItem.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  cursor: pointer;
}
.imageRight {
  height: 67px;
  line-height: 67px;
  display: inline-block;
}
.imageRight div {
  height: 25px;
  line-height: 25px;
  font-size: 19px;
}
.yh_green {
  color: #a1d647;
}
.yh_orange {
  color: orange;
}
.yh_red {
  color: red;
}
.item {
  height: 30px;
  line-height: 30px;
  font-size: 22px;
  color: #eff0f1;
}
</style>
<style>
.number .te-dataBoc--item span {
  background: linear-gradient(
    to bottom,
    #00c6ff,
    transparent,
    #00c6ff
  ) !important;
}
</style>
